﻿using System;
namespace GtsServer.Model
{
    /// <summary>
    /// 1
    /// </summary>
    [Serializable]
    public partial class TaskCondition
    {
        public TaskCondition()
        { }
        #region Model
        private int _id;
        private string _name;
        private int _taskid;
        private int _operator;
        private string _conditionvalue;
        private bool? _isfirstmeet;
        private int _prizeID;
        private int _chanceMouldID;
        private int _eventID;
        private int _taskMouldConditionID;

        public int TaskMouldConditionID
        {
            get { return _taskMouldConditionID; }
            set { _taskMouldConditionID = value; }
        }

        public int ChanceMouldID
        {
            get { return _chanceMouldID; }
            set { _chanceMouldID = value; }
        }

        public int EventID
        {
            get { return _eventID; }
            set { _eventID = value; }
        }

        public int PrizeID
        {
            get { return _prizeID; }
            set { _prizeID = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int ID
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 任务条件名称
        /// </summary>
        public string Name
        {
            set { _name = value; }
            get { return _name; }
        }
        /// <summary>
        /// 任务类型id
        /// </summary>
        public int TaskID
        {
            set { _taskid = value; }
            get { return _taskid; }
        }
        /// <summary>
        /// 运算符（=，<,>,<=,>=等）
        /// </summary>
        public int Operator
        {
            set { _operator = value; }
            get { return _operator; }
        }
        /// <summary>
        /// 条件值
        /// </summary>
        public string ConditionValue
        {
            set { _conditionvalue = value; }
            get { return _conditionvalue; }
        }
        /// <summary>
        /// 是否先满足才能进入任务（true必须满足才能进入比赛页面，false可以进入比赛页面但是参加比赛时判断条件）
        /// </summary>
        public bool? IsFirstMeet
        {
            set { _isfirstmeet = value; }
            get { return _isfirstmeet; }
        }
        #endregion Model

    }

    public class TaskConditionShow : TaskCondition
    {
        public TaskConditionShow() { }

        public static void InitModelAndMouldName(TaskConditionShow model)
        {
            foreach (var item in Enum.GetValues(typeof(EnumTaskConditionMould)))
            {
                if (model.TaskMouldConditionID == Convert.ToInt32(item))
                {
                    model.TaskMouldConditionName = item.ToString();
                    break;
                }
            }
        }

        private string _prizeName;
        private string _chanceMouldName;
        private string _eventName;
        private string _taskMouldConditionName;

        public string TaskMouldConditionName
        {
            get { return _taskMouldConditionName; }
            set { _taskMouldConditionName = value; }
        }

        public string EventName
        {
            get { return _eventName; }
            set { _eventName = value; }
        }

        public string ChanceMouldName
        {
            get { return _chanceMouldName; }
            set { _chanceMouldName = value; }
        }

        public string PrizeName
        {
            get { return _prizeName; }
            set { _prizeName = value; }
        }
    }
}

